import 'package:flame/game.dart';
import 'package:flutter/material.dart';
class PauseMenu extends StatelessWidget {
  final Game game;
  static const String menuId = 'PauseMenu';
  final TextStyle shadowStyle = const TextStyle(
      fontSize: 24,
      shadows: [Shadow(color: Colors.white,blurRadius: 10)]
  );
  PauseMenu({required this.game});

  @override
  Widget build(BuildContext context) {
    return Material(
      color: Colors.transparent,
      child: Center(
        child: Container(
          color: Colors.black54,
          alignment: Alignment.center,
          padding: const EdgeInsets.symmetric(vertical: 20),
          child: Wrap(
            spacing: 20,
            direction: Axis.vertical,
            crossAxisAlignment: WrapCrossAlignment.center,
            children: [
              Text('游戏暂停', style: shadowStyle,),
              ElevatedButton(onPressed: () {
                _continue();
              }, child: const Text('继续游戏')),
              ElevatedButton(onPressed: () {
                _restart();
              }, child: const Text('重新开始')),
              ElevatedButton(onPressed: () {
                _exit();
              }, child: const Text('退出游戏'))
            ],
          ),
        ),
      ),
    );
  }

  void _restart() {

  }

  void _continue() {
    game.resumeEngine();
    game.overlays.remove(menuId);
  }

  void _exit() {

  }
}
